using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Maxleaf.EDI.Domain.EDI;

namespace Maxleaf.EDI.DataAccess.EDI.Mapping
{
    public class EX_BillMap : EntityTypeConfiguration<EX_Bill>
    {
        public EX_BillMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Finterid, t.DBID, t.FTranType, t.FTableName, t.ExRow, t.ExCol, t.EXField, t.KField, t.FFieldType, t.FDeleted});

            // Properties
            this.Property(t => t.Finterid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.DBID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FTranType)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FTableName)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.ExRow)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ExCol)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.EXField)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.KField)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.FFieldType)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.FDeleted)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

       

            // Table & Column Mappings
            this.ToTable("EX_Bill");
            this.Property(t => t.Finterid).HasColumnName("Finterid");
            this.Property(t => t.DBID).HasColumnName("DBID");
            this.Property(t => t.FTranType).HasColumnName("FTranType");
            this.Property(t => t.FTableName).HasColumnName("FTableName");
            this.Property(t => t.ExRow).HasColumnName("ExRow");
            this.Property(t => t.ExCol).HasColumnName("ExCol");
            this.Property(t => t.EXField).HasColumnName("EXField");
            this.Property(t => t.KField).HasColumnName("KField");
            this.Property(t => t.FFieldType).HasColumnName("FFieldType");
            this.Property(t => t.FDeleted).HasColumnName("FDeleted");
 
        }
    }
}
